% $URL: http://planar-rendering.googlecode.com/svn/trunk/matlab/graph.m $
% $Date: 2009-04-20 01:12:01 +0000 (Mon, 20 Apr 2009) $
% $Rev: 74 $

function graph
	% Load the slice data.
	data = load('data.tsv');
	
	dim = 200;
	
	% Extract the slice matrices.
	vol = zeros(dim, dim, dim);
	for z = 1:dim
		vol(:,:,z) = data((1+(z-1)*dim):(z*dim), 1:dim);
	end
	
	% Create the stupidly redundant and inexplicably reversed coordinate system.
	[cx, cy, cz] = meshgrid(1:dim, 1:dim, 1:dim);

	hpatch = patch(isosurface(cx, cy, cz, vol, 0.5));
	set(hpatch, 'FaceColor', 'red');
	camlight;
	lighting phong;
end
